(function(jQuery) {
    jQuery.validator.addMethod("mobile", function (value, element) {
        var length = value.length;
        var mobile = /^1[123456789]\d{9}$/;
        /*/^1(3|4|5|7|8)\d{9}$/*/
        return this.optional(element) || (length == 11 && mobile.test(value));
    }, "请输入正确的手机号码");
    jQuery.validator.addMethod("time-code-control", function (value, element) {
        var now = new Date(),
            val = new Date(value),
            fmt = $(element).attr("format"),
            o = {
                "y+" : function () {
                    return {result:val.getFullYear() < now.getFullYear(),d:val.getFullYear() == now.getFullYear()};
                },
                "M+" : function () {
                    return {result:(val.getMonth()+1) < (now.getMonth()+1),d:(val.getMonth()+1) == (now.getMonth()+1)};
                },                 //月份
                "d+" : function () {
                    return {result:val.getDate() < now.getDate(),d:val.getDate() == now.getDate()};
                },                    //日
                "h+" : function () {
                    return {result:val.getHours() < now.getHours(),d:val.getHours() == now.getHours()};
                },                   //小时
                "m+" : function () {
                    return {result:val.getMinutes() < now.getMinutes(),d:val.getMinutes() == now.getMinutes()};
                },                 //分
                "s+" : function () {
                    return {result:val.getSeconds() < now.getSeconds(),d:val.getSeconds() == now.getSeconds()};
                }                 //秒
            },
            boo = {
                result: false,
                d: true
            };

        for(var k in o) {
            if(new RegExp("("+ k +")").test(fmt) && !boo.result && boo.d){
                boo = o[k]();
            }
        }
        return !boo.result;
    }, "请输入正确的时间");
})($);